<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <p:panel header="CONTRATOS" style="width:1500px">
        <h:form id="formContratos">
            <h:panelGrid columns="9" cellpadding="5">
                Nome:
                <p:inputText size="30" value="#{contratoBean.contrato.projeto.nome}"/>
                Categoria:
                <p:selectOneMenu id="categoria" value="#{contratoBean.contrato.projeto.categoria}"
                                 converter="categoriaConverter"  >
                    <f:selectItem itemLabel="-- Selecione --" />
                    <f:selectItems value="#{categoriaBean.categorias}" var="categoria"
                                   itemValue="#{categoria}" itemLabel="#{categoria.nome}"/>

                </p:selectOneMenu> 
                Ano:
                <p:selectOneMenu id="ano">
                    <f:selectItem itemLabel="-- Selecione --" />
                </p:selectOneMenu> 
                Em aberto
                <p:selectBooleanCheckbox>  

                </p:selectBooleanCheckbox>
                <p:commandButton value="Pesquisar" update="gridContratos" action="#{contratoBean.pesquisar}"/>
            </h:panelGrid>
            <br/><br/>
            <p:dataTable id="gridContratos"  var="contrato" value="#{contratoBean.contratos}"
                         emptyMessage="Nenhum registro encontrado"
                         paginator="true" rows="10"  
                         paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" 
                         rowKey="#{contrato.id}"
                         selection="#{contratoBean.projConsultado}" selectionMode="single" >
                <!-- <p:ajax event="rowSelect" update="botoes"/> -->
                <p:column headerText="Projeto">
                    <h:outputText value="#{contrato.projeto.nome}"/>
                </p:column>
                <!-- <p:column headerText="Valor">
                    <h:outputText value="#{contrato.valor}"/>
                </p:column>-->
                <p:column headerText="Freelancer">
                    <h:outputText value="#{contrato.freelancer.nome}"/>
                </p:column>

                <p:column headerText="Duração"> 
                    <h:outputText value="#{contrato.projeto.duracao}"/>

                </p:column>

                <f:facet name="footer">
                   <!--  <h:panelGroup id="botoes">
                        <p:button id="btVisualizar" icon="ui-icon-search" value="Visualizar" outcome="contratos/consultarProjeto">
                            <f:param name="contrato" value="#{contratoBean.projConsultado.id}" />
                        </p:button>
                        <p:button id="btLances" value="Lances" outcome="/lance/exibirLances" >
                            <f:param name="contrato" value="#{contratoBean.projConsultado.id}" />
                        </p:button>
                    </h:panelGroup>-->
                </f:facet>

            </p:dataTable>
        </h:form>
    </p:panel>


</html>

